<%@page import="priv.mill.entry.UserInfo"%>
<%@page import="priv.mill.entry.Question"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@page import="java.util.Date"%>
<%
String path = request.getContextPath();
String basePath =request.getScheme()+"://"+request.getServerName()+":"
+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<base href="<%=basePath%>">
<title>搜索</title>
<link href="bootstrap/css/bootstrap.css" rel="stylesheet">
<script src="bootstrap/js/jquery-1.12.4.js"></script>
<script src="bootstrap/js/bootstrap.js"></script>
<script src="js/date.js"></script>
<link rel='stylesheet' id='reset-css'  href='css/reset.css' type='text/css' media='all' />
<link rel='stylesheet' id='superfish-css'  href='css/superfish.css' type='text/css' media='all' />
<link rel='stylesheet' id='fontawsome-css'  href='css/font-awsome/css/font-awesome.css' type='text/css' media='all' />
<link rel='stylesheet' id='orbit-css-css'  href='css/orbit.css' type='text/css' media='all' />
<link rel='stylesheet' id='style-css'  href='css/style.css' type='text/css' media='all' />
<link rel='stylesheet' id='color-scheme-css'  href='css/color/green.css' type='text/css' media='all' />
<link rel="stylesheet" href="css/zerogrid.css" type="text/css" media="screen">
<link rel="stylesheet" href="css/responsive.css" type="text/css" media="screen">
<script type='text/javascript' src='js/jquery.js'></script>
<script type='text/javascript' src='js/jquery-migrate.min.js'></script>
<script type='text/javascript' src='js/jquery-1.10.2.min.js'></script>
<script type='text/javascript' src='js/jquery.carouFredSel-6.2.1-packed.js'></script>
<script type='text/javascript' src='js/hoverIntent.js'></script>
<script type='text/javascript' src='js/superfish.js'></script>
<script type='text/javascript' src='js/orbit.min.js'></script>
 <script src="js/css3-mediaqueries.js"></script>
<script type="text/javascript" language="javascript">
	$(function() {
		
		/* Start Carousel */
		$('#featured-posts').carouFredSel({
			auto: true,
					prev: '#prev2',
					next: '#next2',
		});
		/* End Carousel */
		
		
		/* Start Orbit Slider */
		$(window).load(function() {
			$('.post-gallery').orbit({
				animation: 'fade',
			});
		});
		/* End Orbit Slider */
			
			
		/* Start Super fish */
		jQuery(document).ready(function(){
			jQuery('ul.sf-menu').superfish({
				delay:         100,
				speed:         'fast',
				speedOut:      'fast',
			});
		});
		/* End Of Super fish */
			
	});
</script>
<script type="text/javascript">
function baocun(){
	var obj = new Object();
	obj.quesTitle=$("#title").val();
	obj.quesDesc=$("#desc").val();
	if(!obj.quesTitle.trim()){
		alert("标题不能为空");
		return false;
	}
	
	if(!/[\w\W]{5,}/.test(obj.quesTitle)){
		alert("标题不能少于五个字");
		return false;
	}
	
	$.post("<%=basePath%>Question2/insertQuestion2",obj,function(result){
		var obj = JSON.parse(result);
		 window.location.href="<%=basePath%>Question2/getQuestionByEntry?qId="+obj.data+"&pageNumber=1";
	});
}
</script>
</head>
<body>
	<!-- Start Header -->
    <div class="container zerogrid">
        <div class="col-full"><div class="wrap-col">
        	<div id="header-nav-container">
            
                    <a href="#">
                    <img src="images/logo.png" id="logo" />
                    </a>
                    
					<!-- Navigation Menu -->
                    
	<ul class="sf-menu"><li class="menu-item current-menu-item"><a href="index.html">主页</a></li>
		<li class="menu-item"><a href="#">登录</a>
<ul class="sub-menu">
	<li class="menu-item"><a href="#">个人资料</a></li>
	<li class="menu-item"><a href="#">退出</a></li>
</ul>
</li>
	<li class="menu-item"><a href="javascript:void(0)" data-toggle="modal" data-target="#myModal">
  提问
</a></li>

<li class="menu-item"><a href="complain.html">申诉</a></li>
</ul>	

<!-- Modal模态框 -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">问题</h4>
      </div>
      <div class="modal-body">
        	标题<br>
        	<input type="text" name="title" id="title"><span></span><br>
        	描述(可选)<br>
        	<input type="text" name="desc" id="desc"><br>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
        <input type="button" class="btn btn-primary" onclick="baocun()" data-dismiss="modal" value="提交"/>
      </div>
    </div>
  </div>
</div>   <!-- 模态框 -->

			<script type="text/javascript">
function search(){
	var te=$("#select").find("option:selected").val();
	var text=$("#s").val();
	if(te=="title"){
		window.location.href="<%=basePath%>Question2/getQuestionsLikeTitle?quesTitle="+encodeURI(text);
	}else if(te=="author"){
		window.location.href="<%=basePath%>Question2/getQuestionsLikeName?uName="+encodeURI(text);
	}
}
</script>
			<!-- End Navigation Menu -->
                  <div class="widget-container">
                  	<select id="select">
					  <option value ="title">标题</option>
					  <option value ="author">作者</option>
					</select>
					<input type="text" value="" name="s" id="s" />
					<input type="button" id="search" onclick="search()" value="搜索" />
			<div class="clear"></div>
                  </div>  
                    <div class="clear"></div>
                    
            </div>
			</div>
        </div>
    <div class="clear"></div> 
    </div>
     <!-- Start Main Container -->
    <div class="container zerogrid">
    
        <!-- Start Posts Container -->
        <div class="col-2-3" id="post-container">
 			<div class="wrap-col" id="showTitle">
 			<%List<Question> questionlist=(List<Question>)request.getAttribute("questionsList");
 			List<UserInfo> userList=(List<UserInfo>)request.getAttribute("UserInfos");
 			if(questionlist!=null&&userList!=null){
 				for(int i=0;i<questionlist.size();i++){
 					Question question=questionlist.get(i);
 					UserInfo uInfo=userList.get(i);
 			%>
	<!-- Start Post Item -->
            <div class="post">
            	<div class="post-margin">
                
                <div class="post-avatar">
                    <div class="avatar-frame"></div>
                    <img alt='' src='../<%= uInfo.getUPhoto()%>' id="userimg" class='avatar avatar-70 photo' height='70' width='70' />   </div>
                
                <h4 class="post-title"><a href="#" id="username"><%=uInfo.getUName()%></a></h4>
                	<ul class="post-status">
                    <li><i class="fa fa-clock-o"></i><span id="time"><%=question.getQUpdateTime()%></span></li>
                      <!--
                    	作者：595850161@qq.com
                    	时间：2017-11-17
                    	描述：<li><i class="fa fa-star "></i><a href="#" title="View all posts in Illustration" rel="category">取消收藏</a></li>
                    -->
                    
                    <li><i class="fa fa-star-o "></i><a href="#" title="View all posts in Illustration" rel="category">收藏</a></li>
                    <li><i class="fa fa-ban "></i><a href="report.html" title="View all posts in Illustration" rel="category">举报</a></li>
                    </ul>
                    <div class="clear"></div>
                </div>
            
            <div class="post-margin">
            <h5><%=question.getQuesTitle() %></h5>
            <p id="desc"><%=question.getQuesDesc() %></p>
            </div>
            
             <ul class="post-social">
             <li><a href="#" target="_blank">
             <i class="fa fa-caret-square-o-up"> 0赞</i></a>
             </li>
                        
             <li>
             <a href="#" target="_blank">
             <i class="fa fa-caret-square-o-down"> 0踩</i></a>
             </li>
            <li><script type="text/javascript">
			(function() {
				var p = {
					url: location.href,
					/*获取URL，可加上来自分享到QQ标识，方便统计*/
					desc: '',
					/*分享理由(风格应模拟用户对话),支持多分享语随机展现（使用|分隔）*/
					title: '',
					/*分享标题(可选)*/
					summary: '',
					/*分享摘要(可选)*/
					pics: '',
					/*分享图片(可选)*/
					flash: '',
					/*视频地址(可选)*/
					site: '',
					/*分享来源(可选) 如：QQ分享*/
					style: '201',
					width: 32,
					height: 32
				};
				var s = [];
				for(var i in p) {
					s.push(i + '=' + encodeURIComponent(p[i] || ''));
				}
				document.write(['<a class="" href="http://connect.qq.com/widget/shareqq/index.html?', s.join('&'), '" target="_blank"><i class="fa fa-plane"> 分享</i></a>'].join(''));
			})();
		</script>
            
            </li>
            
             <li>
             <a href="#" target="_blank">
             <i class="fa fa-comment-o"> Xx回答</i></a>
             </li>
            
            <li>
            <a href="<%=basePath%>Question2/getQuestionByEntry?qId=<%=question.getQId()%>&pageNumber=1" class="readmore">阅读全文 <i class="fa fa-arrow-circle-o-right"></i></a>
            </li>
            </ul>
            
            <div class="clear"></div>
            </div>
            <!-- End Post Item -->
            <%}} %>
             
		 <!-- End Pagination -->
        <div class="clear"></div>
		</div>
        </div>
        <!-- End Posts Container -->
		
        <!-- Start Sidebar -->
    	<div class="col-1-3">
		<div class="wrap-col">
			<div class="widget-container"><form role="search" method="get" id="searchform" class="searchform" action="#">
				<div>
					<label class="screen-reader-text" for="s"></label>
					<input type="text" value="" name="s" id="s" />
					<input type="submit" id="searchsubmit" value="搜索问题" />
				</div>
			</form><div class="clear"></div></div>
	    	<div class="widget-container"><h6 class="widget-title">目录</h6>		<ul>
	<li class="cat-item cat-item-5"><a href="myQuestion.html" title="View all posts filed under Apps">我的提问</a>
</li>
	<li class="cat-item cat-item-3"><a href="myCollection.html" title="View all posts filed under Illustration">我的收藏</a>
</li>
	<li class="cat-item cat-item-4"><a href="myAnswer.html" title="View all posts filed under Logo">我的回答</a>
</li>
		</ul>
<div class="clear"></div></div><div class="widget-container"><h6 class="widget-title">优秀回答</h6>	<!-- Start Widget -->
                <ul class="widget-recent-posts">
                                
                <li>
                <div class="post-image">
                <div class="post-mask"></div>
                <img width="70" height="70" src="img/HighRes-70x70.jpg" class="attachment-post-widget #"  />                </div>
                
                <h6><a href="#">张三</a></h6>
                <span>6个回答</span>
                <div class="clear"></div>
                </li> 
                
                                
                <li>
                <div class="post-image">
                <div class="post-mask"></div>
                <img width="70" height="70" src="img/one-more-beer-70x70.png" class="attachment-post-widget #"  />                </div>
                
                <h6><a href="#">李四</a></h6>
                <span>120个回答</span>
                <div class="clear"></div>
                </li> 
                
                                
                <li>
                <div class="post-image">
                <div class="post-mask"></div>
                <img width="70" height="70" src="img/Port_Harbor1-70x70.jpg" class="attachment-post-widget #"  />                </div>
                
                <h6><a href="#">麻子</a></h6>
                <span>9回答</span>
                <div class="clear"></div>
                </li> 
                
                                
                <li>
                <div class="post-image">
                <div class="post-mask"></div>
                <img width="70" height="70" src="img/Timothy-J-Reynolds-2560x14401-70x70.jpg" class="attachment-post-widget #"  />                </div>
                
                <h6><a href="#">马化腾</a></h6>
                <span>37个回答</span>
                <div class="clear"></div>
                </li> 
                
                 
                </ul>
   <!-- End Widget -->
<div class="clear"></div></div>    <div class="clear"></div>
</div></div>        <!-- End Sidebar -->
    
    <div class="clear"></div>
    </div>
	<!-- End Main Container -->
	  <!-- Start Footer -->
    <div class="spacing-30"></div>
    <div class="container zerogrid">
        <div id="footer-container" class="col-full">
        <div class="wrap-col">	
            <!-- Footer Copyright -->
            <p>&copy; Copyright &copy; 2014.Company name All rights reserved.<a target="_blank" href="http://www.freemoban.com/">www.freemoban.com</a></p>
            <!-- End Footer Copyright -->
            
            <!-- Footer Logo -->
			<img src="images/footer-logo.png" id="footer-logo" />
            <!-- End Footer Logo -->
        
        <div class="clear"></div>
		</div>
        </div>
    </div>
    <!-- End Footer -->
</body>
</html>